package org.go.examples.example_01;

import java.util.Date;
import java.util.List;

import org.go.DisallowConcurrentExecution;
import org.go.Go;
import org.go.GoContext;
import org.go.expcetion.GoException;
import org.go.expcetion.WorkExecutionException;

/**
 * This is the simplest task form: a class implementing the {@link Runnable}
 * interface.
 * @param <T>
 */
@DisallowConcurrentExecution
public class MyTask implements Runnable, Go {
	/**
	 * 
	 */
	private static final long serialVersionUID = 5226041849158812793L;

	@Override
	public void run() {
		System.out.println("MyTask Current system time: " + new Date() + " ,Thread name is : " + Thread.currentThread().getName());
		//System.out.println("MyTask currentThread : " + Thread.currentThread().getName());
		//		try {
		//			Thread.sleep(1000L * 100);
		//		} catch (InterruptedException e) {
		//			e.printStackTrace();
		//		}
		System.out.println("Another minute ticked away..." + new Date() + " ,Thread name is : " + Thread.currentThread().getName());
		System.out.println("");
	}

	@Override
	public Boolean doWork(GoContext context) throws WorkExecutionException {
		System.out.println("MyTask Current system time: " + new Date() + " ,Thread name is : " + Thread.currentThread().getName());
		System.out.println("Another minute ticked away: " + new Date() + " ,Thread name is : " + Thread.currentThread().getName());
		System.out.println("");
		return true;
	}

	@Override
	public List selectWork(String taskParameter, String ownSign, int taskItemNum, List taskItemList, int eachFetchDataNum) throws GoException {
		// TODO Auto-generated method stub
		return null;
	}
}
